
#include "Invoker.h"

using namespace npCommand;


Invoker::Invoker() // class inheritance
{
    //To initialize data member;
    this->command = nullptr;
}

Invoker::~Invoker()
{
    //To delete dynamic data member
}

Invoker::Invoker(const Invoker& cpy) // class inheritance
{
    //To copy data member
    this->command = cpy.command;
}

Invoker& Invoker::operator=(const Invoker& asn)
{
    if (this == &asn)
    {
        return *this;
    }
    else
    {
        //To invoke base class operator=
        
        //To assign data member, note to delete dynamic member if exists.
        this->command = asn.command;
        return *this;
    }
}

Invoker* Invoker::clone() const
{
    //return new
    return new Invoker(*this);
}

//other constructors

//public methods
void Invoker::setCommand(Command* command) throw()
{
    this->command = command;
}

void Invoker::executeCommand() throw()
{
    if (this->command)
    {
        this->command->execute();
    }
}

//protected methods

//private methods
